import { Controller, Get, Param } from "@nestjs/common";
import { AppService } from "./app.service";

@Controller()
export class AppController {
    constructor(private readonly appService: AppService) {}

    @Get("all")
    async getAll(): Promise<string> {
        let res = await this.appService.getAll();
        return res;
    }

    @Get("find/:id")
    async getOne(@Param("id") id: string): Promise<string> {
        let res = await this.appService.getOne(id);
        return res;
    }

    @Get("add/:name")
    async addOne(@Param("name") name: string): Promise<string> {
        let res = await this.appService.addOne(name);
        return res;
    }

    @Get("remove/:id")
    async removeOne(@Param("id") id: string): Promise<string> {
        let res = await this.appService.deleteOne(id);
        return res;
    }
}
